package net.joey.reflect;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import net.joey.ognl.Department;
import net.joey.ognl.Something;
import net.joey.ognl.User;
import net.joey.ognl.User2;

public class TestMain {

	public static void main(String[] args) {
		System.out.println(ClassA.class);
		System.out.println(ClassA.class.getClassLoader());
		try {
			System.out.println(ClassLoader.getSystemClassLoader().getClass().getClassLoader());
			System.out.println(ClassLoader.getSystemClassLoader().getParent());
			System.out.println(ClassLoader.getSystemClassLoader().getClass());
			Class.forName("net.joey.reflect.ClassA",false,TestMain.class.getClassLoader());
			System.out.println("************");
			System.out.println(boolean.class);
			System.out.println(int.class);
			System.out.println(void.class);
			int[] aa = new int[10];
			System.out.println(int[].class);
			System.out.println(aa.getClass());
			Something u = new User();
			Something u2 = new User2();
			Method ms = u.getClass().getMethod("setName", String.class);
			Method mg = u.getClass().getMethod("getName");
			ms.invoke(u2,"u2");
			System.out.println(mg.invoke(u));
			System.out.println(u);
			System.out.println(u2);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
